#include <linux/module.h>
#include <linux/ioport.h>
#include <linux/platform_device.h>

#include "board_led.h"


///* 单板A的led资源 */
//static struct led_resource board_A_led = {
//	.pin = GPIO_PIN(5, 1)
//};
//
//
//struct led_resource *get_led_resource(void)
//{
//	return &board_A_led;
//}

/*
	定义引脚资源
*/
static struct resource imx6ull_led_resources[] = {
	{
		.start		= GPIO_PIN(1, 3),
		.flags		= IORESOURCE_IRQ,
		.name 	 	= "imx6ull_leds_pin",
	},
	{
		.start		= GPIO_PIN(5, 1),
		.flags		= IORESOURCE_IRQ,
		.name 	 	= "imx6ull_leds_pin",
	},
};

static void led_platform_release(struct device *dev)
{
}

static struct platform_device led_platform = {
	.name			= "imx6ull_leds",
	.num_resources 	= ARRAY_SIZE(imx6ull_led_resources),  //资源个数
	.resource 		= imx6ull_led_resources,   //通过resource数组指定硬件资源
	.dev = {
		.release = led_platform_release,
	},
};


static int led_platform_init(void)
{
	int err;
	err = platform_device_register(&led_platform);
	
	return 0;
}

static void led_platform_exit(void)
{
	platform_device_unregister(&led_platform);
}

module_init(led_platform_init);
module_exit(led_platform_exit);
MODULE_LICENSE("GPL");




